// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   change_ok.java

package hr.engage.questiones;

import include.nseer_cookie.counter;
import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class change_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public change_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			PrintWriter out = response.getWriter();
			nseer_db_backup1 hr_db = new nseer_db_backup1(dbApplication);
			counter count = new counter(dbApplication);
			if (hr_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String id = request.getParameter("id");
				String first_kind_ID = "";
				String first_kind_name = "";
				String second_kind_ID = "";
				String second_kind_name = "";
				String first_kind = request.getParameter("select1");
				for (StringTokenizer tokenTO4 = new StringTokenizer(first_kind, "/"); tokenTO4.hasMoreTokens();)
				{
					first_kind_ID = tokenTO4.nextToken();
					first_kind_name = tokenTO4.nextToken();
				}

				String second_kind = request.getParameter("select2");
				for (StringTokenizer tokenTO5 = new StringTokenizer(second_kind, "/"); tokenTO5.hasMoreTokens();)
				{
					second_kind_ID = tokenTO5.nextToken();
					second_kind_name = tokenTO5.nextToken();
				}

				String changer = request.getParameter("changer");
				String change_time = request.getParameter("change_time");
				String derivation = request.getParameter("derivation");
				String body = new String(request.getParameter("body").getBytes("UTF-8"), "UTF-8");
				String content = exchange.toHtml(body);
				String bodya = new String(request.getParameter("bodya").getBytes("UTF-8"), "UTF-8");
				String keya = exchange.toHtml(bodya);
				String bodyb = new String(request.getParameter("bodyb").getBytes("UTF-8"), "UTF-8");
				String keyb = exchange.toHtml(bodyb);
				String bodyc = new String(request.getParameter("bodyc").getBytes("UTF-8"), "UTF-8");
				String keyc = exchange.toHtml(bodyc);
				String bodyd = new String(request.getParameter("bodyd").getBytes("UTF-8"), "UTF-8");
				String keyd = exchange.toHtml(bodyd);
				String bodye = new String(request.getParameter("bodye").getBytes("UTF-8"), "UTF-8");
				String keye = exchange.toHtml(bodye);
				String correctkey = request.getParameter("correctkey");
				try
				{
					String sql = (new StringBuilder("update hr_questiones set first_kind_ID='")).append(first_kind_ID).append("',second_kind_ID='").append(second_kind_ID).append("',first_kind_name='").append(first_kind_name).append("',second_kind_name='").append(second_kind_name).append("',register='").append(changer).append("',register_time='").append(change_time).append("',derivation='").append(derivation).append("',content='").append(content).append("',keya='").append(keya).append("',keyb='").append(keyb).append("',keyc='").append(keyc).append("',keyd='").append(keyd).append("',keye='").append(keye).append("',correctkey='").append(correctkey).append("' where id='").append(id).append("'").toString();
					hr_db.executeUpdate(sql);
				}
				catch (Exception ex)
				{
					out.println((new StringBuilder("error")).append(ex).toString());
				}
				hr_db.commit();
				hr_db.close();
				response.sendRedirect("hr/engage/questiones/change_ok_a.jsp");
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
